DM 1: Hopping models, transfer matrix and jamming
In this exercise, we study two hopping models for one-dimensional transport.
The first model describes the equilibrium dynamics of a single particle moving on a one dimensional lattice.
The second one describes the non-equilibrium transport of particles between two reservoirs, in absence of external potential, and with exclusion interaction between particles. Although one-dimensional, this model presents a phase transition, linked to jamming.
We apply two methods to study these models: the Monte Carlo Markov Chain (MCMC) algorithm and the transfer matrix.
Don't hesitate to ask questions and make remarks onthis wiki page.
Markov Chain Monte Carlo method
We would like to sample a configuration C with a given probability πC. A solution for this problem is the Markov Chain Monte Carlo method. We define a dynamics over the ensemble of configurations {C} such that, in the long time limit each configuration is visited with the correct probability πC. As discussed in the lecture, a Markov chain describes the stochastic evolution which is fully specified by the transition probabilities
between configurations C and C'. The probability πC(t) of being at time t in configuration C evolves according to
To ensure that πC(t) converges towards the probability distribution πC, one must satisfy the global balance condition:
The detailed balance is more restrictive:
but it leads towards the same probability distribution in the long-time limit.
Model 1 - hopping in a box: the Markov Chain Monte Carlo method
As an example we consider a particle on a system of L sites and an hard wall at sites 0 and L-1. At the equilibrium the particle occupies site i with a probability 1/L. To sample a configuration according to that probability, a possibility is to implement a dynamics in which the particle jumps from one site to one of its neighboring sites with a probability verifying detailed balance. Below we implement the corresponding Markov chain with the Metropolis algorithm.
A particle hopping on a one-dimensional lattice with L sites .
As a first test, consider the program below.
importrandom, pylab,mathrandom.seed('CFP')
Ntime =10000
L =8
k = L/2
all_pos =[k]for itime inrange(Ntime):
l=(k + random.randint(0,1)*2 -1)if l inrange(L): k = l
all_pos.append(k)
pylab.hist(all_pos, bins = L,range=(-0.5,L-0.5), normed =True)
pylab.title('Markov Chain')
pylab.xlabel('Site')
pylab.ylabel('Occupation probability')
pylab.show()
Explain why the detailed balance is respected
Check numerically that the above program converges to πi. Plot the histograms for Ntime=100, 10000... to show that the agreement improves with increasing Ntime.
Explain the signification of l = (k + random.randint(0,1)*2 -1) and if l in range(L): k = l
Replace the previous two line with: k = (k + random.randint(0,1)*2 -1)%L . Which boundary condition do you implement? What happens to the occupation probability?
Instead of this Markov Chain algorithm, can you imagine an simple algorithm which samples exactly the configurations according to the equilibrium law?
Model 1 - hopping in a box: the transfer matrix method
We now solve Model 1 using the transfer matrix method.
The ensemble of all transition probabilities can be represented in the transfer matrix of the system. The function transfer_calc computes the transfer matrix of Model 1. We introduce a new package: numpy. This package is very useful for handling matrices, linear algebra operations...
importmath, numpy
def transfer_calc(L):
neighbor =[[min(k+1,L-1),max(k-1,0)]for k inrange(L)]
transfer = numpy.zeros((L,L))for k inrange(L):
transfer[neighbor[k][0],k]=0.5
transfer[neighbor[k][1],k]=0.5return transfer
The transfer matrix controls the time evolution of all possible simulations performed with Markov Chain algorithm. This program implements the time evolution for the Model 1. The matrix vector product is implemented by a numpy function! (Remark: you have to copy-and-paste the function transfer_calc in the previous program to get a single file.)
import pylab,math, numpy
Ntime =20
L =10
transfer = transfer_calc(L)
position = numpy.zeros((L))
position[L/2]=1for itime inrange(Ntime):
position = numpy.dot(transfer,position)
pylab.title('Transfer matrix')
pylab.xlabel('Site')
pylab.ylabel('Occupation probability')
grid=range(L)
pylab.ylim(ymin =0, ymax =0.5)
pylab.plot(grid,position,'bo')
pylab.show()
How is prepared the system at time Ntime=0? Is the initial condition important for the long time limit?
Check the convergence as a function of Ntime (Try Ntime=10, 100 ...). Write explicitly the transfer matrix for L=3.
Compute sum(position). Does it change with Ntime? Why?
We study now the eigenvalues and eigenvectors of the Transfer Matrix using numpy.
import pylab,math, numpy
L =4
transfer = transfer_calc(L)
w,v = numpy.linalg.eig(transfer)print w[0],v[:,0]print w[1],v[:,1]print w[2],v[:,2]print w[3],v[:,3]
Why is the largest eigenvalue equal to 1? Give the physical meaning of the left and right eigenvectors associated to the eigenvalue 1 (in the program v is the right eigenvector and w is the eigenvalue).
We call λ2 the second largest eigenvalue. Explain why the time scale Δ = -1 / (log λ2) gives the relaxation time towards equilibrium.
Study the behavior of Δ as a function of L, numerically and analytically. Comment.
Bonus: Change the transfer matrix algorithm to implement periodic boundary conditions. If you repeat the simulations, the equilibrium is not reached. Explain why and propose a solution to fix this problem.
Model 2: the Totally Asymmetric Exclusion Process (TASEP)
In the previous examples the occupation probability πC was known and we checked if the dynamics defined by transition probabilities
was sampling the steady state distribution πC in the large time limit.
In the following example the problem is reversed: the transition probabilities are given and we look for the corresponding occupation probability πC.
The system is described by a one-dimensional lattice of L sites with open boundary conditions. Each site is either empty or occupied by a single particle (in general there is more than one particle in the system). Different moves are possible: (i) each particle can jump to its right, provided the target site is empty (the process is totally asymmetric), (ii) a particle can be injected at site 0 when empty, while (iii) ejected at site L-1 when occupied (the system is in contact with two reservoirs).
The process is totally asymmetric: each particle can jump to its right, provided the target site is empty (exclusion). The system is in contact with two reservoirs.
The dynamics is defined as follows:
At each step we select at random one of the possible moves.
We check whether this move is allowed or not.
If the move occurs in the bulk of the system, we accept it (case (i)).
If the move is a particle injection, we accept it with probability α (case (ii)).
If the move is a particle ejection, we accept it with probability β (case (iii)).
Below we implement the Markov chain corresponding to this dynamics.
importrandom, pylab,mathrandom.seed(2)
L =100
alpha =.3
beta =.1
Ntime =100000
state =[0for k inrange(L+1)]foriterinrange(Ntime):
k =random.randint(0,L)if k ==0:
ifrandom.random()< alpha: state[1]=1elif k == L:
ifrandom.random()< beta: state[L]=0elif state[k]==1and state[k+1]==0:
state[k+1]=1
state[k]=0if iter%2000==0:
yaxis =[]for i inrange(L):
if state[i+1]==1: yaxis.append(i)
xaxis=[iterfor k inrange(len(yaxis))]
pylab.plot(xaxis,yaxis,'ro')
pylab.xlabel('Number of steps')
pylab.ylabel('System configuration')
pylab.show()
How many moves are possible?
Describe what you observe in the system for the following values of the probabilitiesα and β:
(i) α < β < 1/2
(ii) β < α< 1/2
In which phase do you observe jamming?
The phase α >1/2 and β > 1/2 is the maximal current phase. Compare the cases
(α,β) = (.6,.8) vs (α,β) = (.8,.6) and
(α,β) = (.1,.3) vs (α,β) = (.3,.1) and
How large is the transfer matrix for this model as a function of L (the number of sites)?
It can be proven that in this example the detailed balance condition is not fulfilled but the global balance is fulfilled. The dynamics converges to a non equilibrium stationary state where a steady current flows through the system.
References, further reading
If you're interested in the TASEP model, you can read for instance:
B. Derrida, E. Domany, D. Mukamel, An exact solution of the one dimensional asymmetric exclusion model with open boundaries, J. Stat. Phys. 69, 667 (1992).
M. R. Evans, R. Juhász, and L. Santen, Shock formation in an exclusion process with creation and annihilation, Phys. Rev. E 68, 026117 (2003).
Table of Contents
In this exercise, we study two hopping models for one-dimensional transport.
- The first model describes the equilibrium dynamics of a single particle moving on a one dimensional lattice.
- The second one describes the non-equilibrium transport of particles between two reservoirs, in absence of external potential, and with exclusion interaction between particles. Although one-dimensional, this model presents a phase transition, linked to jamming.
We apply two methods to study these models: the Monte Carlo Markov Chain (MCMC) algorithm and the transfer matrix.Don't hesitate to ask questions and make remarks on this wiki page.
Markov Chain Monte Carlo method
We would like to sample a configuration C with a given probability πC. A solution for this problem is the Markov Chain Monte Carlo method. We define a dynamics over the ensemble of configurations {C} such that, in the long time limit each configuration is visited with the correct probabilityπC. As discussed in the lecture, a Markov chain describes the stochastic evolution which is fully specified by the transition probabilities
between configurations C and C'. The probability πC(t) of being at time t in configuration C evolves according to
To ensure that πC(t) converges towards the probability distribution πC, one must satisfy the global balance condition:
The detailed balance is more restrictive:
but it leads towards the same probability distribution in the long-time limit.
Model 1 - hopping in a box: the Markov Chain Monte Carlo method
As an example we consider a particle on a system of L sites and an hard wall at sites 0 and L-1. At the equilibrium the particle occupies site i with a probability 1/L. To sample a configuration according to that probability, a possibility is to implement a dynamics in which the particle jumps from one site to one of its neighboring sites with a probability verifying detailed balance. Below we implement the corresponding Markov chain with the Metropolis algorithm.Model 1 - hopping in a box: the transfer matrix method
We now solve Model 1 using the transfer matrix method.The ensemble of all transition probabilities can be represented in the transfer matrix of the system. The function transfer_calc computes the transfer matrix of Model 1. We introduce a new package: numpy. This package is very useful for handling matrices, linear algebra operations...
The transfer matrix controls the time evolution of all possible simulations performed with Markov Chain algorithm. This program implements the time evolution for the Model 1. The matrix vector product is implemented by a numpy function! (Remark: you have to copy-and-paste the function transfer_calc in the previous program to get a single file.)
We study now the eigenvalues and eigenvectors of the Transfer Matrix using numpy.
Model 2: the Totally Asymmetric Exclusion Process (TASEP)
In the previous examples the occupation probability πC was known and we checked if the dynamics defined by transition probabilitieswas sampling the steady state distribution πC in the large time limit.
In the following example the problem is reversed: the transition probabilities are given and we look for the corresponding occupation probability πC.
The system is described by a one-dimensional lattice of L sites with open boundary conditions. Each site is either empty or occupied by a single particle (in general there is more than one particle in the system). Different moves are possible: (i) each particle can jump to its right, provided the target site is empty (the process is totally asymmetric), (ii) a particle can be injected at site 0 when empty, while (iii) ejected at site L-1 when occupied (the system is in contact with two reservoirs).
Below we implement the Markov chain corresponding to this dynamics.
- How many moves are possible?
- Describe what you observe in the system for the following values of the probabilitiesα and β:
- In which phase do you observe jamming?
- The phase α >1/2 and β > 1/2 is the maximal current phase. Compare the cases
- How large is the transfer matrix for this model as a function of L (the number of sites)?
It can be proven that in this example the detailed balance condition is not fulfilled but the global balance is fulfilled. The dynamics converges to a non equilibrium stationary state where a steady current flows through the system.(i) α < β < 1/2
(ii) β < α < 1/2
(α,β) = (.6,.8) vs (α,β) = (.8,.6) and
(α,β) = (.1,.3) vs (α,β) = (.3,.1) and
References, further reading
If you're interested in the TASEP model, you can read for instance:print this page